package com.hai.controller;

import com.hai.entity.Department;
import com.hai.response.Result;
import com.hai.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author NieChangan
 * @since 2022-05-21
 */
@RestController
@RequestMapping("/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 功能描述: <br>
     * 〈分组查询部门的名字和人数〉
     * @Param:
     * @Return:
     * @Author: Mr.Nie
     * @Date:
     */
    @GetMapping("/DepartList")
    Result getDepartmentNameAndCount(){
        List<Department> departList = departmentService.getDepartmentNameAndCount();
        return Result.ok().data("departList",departList);
    }
}
